<?php
namespace App\Services;

use App\Models\ClassStudentModel;
use App\Models\ClassModel;

class ClassService {
    public static function removeStudent($studentId, $classId = 0) {
        // 删除班级学生关系
        ClassStudentModel::where('class_id', $classId)->where('student_id', $studentId)->delete();
        
        // 更新班级的学生数量
        ClassModel::where('id', $classId)->decrement('total_num', 1);
    }
}